package com.ruoyi.web.controller.tzzl;

import com.alipay.api.AlipayApiException;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.tzzl.domain.WzWithdrawalRecord;
import com.ruoyi.tzzl.domain.vo.QueryVo;
import com.ruoyi.tzzl.service.IWzWithdrawalRecordService;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 提现申请Controller
 * @author by caoyong
 * @date 2022/11/17
 **/
@RestController
@RequestMapping("/tzzl/withdrawal")
public class WzWithdrawalRecordController extends BaseController {

    @Autowired
    private IWzWithdrawalRecordService wzWithdrawalRecordService;

    /**
     * 查询提现申请列表
     */
    @GetMapping("/list")
    public TableDataInfo list(QueryVo queryVo)
    {
        startPage();
        List<WzWithdrawalRecord> list = wzWithdrawalRecordService.selectWzWithdrawalRecordList(queryVo);
        return getDataTable(list);
    }

    /**
     * 申请提现
     * */
    @PostMapping("/applyWithdrawal")
    public AjaxResult  applyWithdrawal(@RequestBody  QueryVo queryVo){

        return AjaxResult.success(wzWithdrawalRecordService.applyWithdrawal(queryVo));
    }

    /**
     * 提现审核
     * */
    @PostMapping("/audit")
    public AjaxResult  audit(@RequestBody QueryVo queryVo) throws AlipayApiException {
        return AjaxResult.success(wzWithdrawalRecordService.audit(queryVo));
    }

    /**查看用户提现金额,待打款金额,可提现金额*/
    @GetMapping("/withdrawalAmount")
    public AjaxResult withdrawalAmount(Long id){
        return AjaxResult.success(wzWithdrawalRecordService.withdrawalAmount(id));
    }


}

